package com.yc.springcloudorder.web;

import com.yc.springcloudorder.bean.User;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;


@RestController
public class OrderAction {

    @RequestMapping("order")
    public String index(HttpServletRequest request){
        int port = request.getServerPort();
        return "Index:" + port;
    }


    @RequestMapping("hello1")
    public String hello(String name){
        return "hello" + name;
    }


    @RequestMapping("hello2/{name}")
    public String hello1(@PathVariable("name") String name){
        return "你好" + name;
    }

    @RequestMapping("showMe")
    public User showMe(@RequestBody User user,@RequestParam String newName){
        user.setAge(user.getAge() + 10);
        user.setName(newName);
        return user;
    }

}
